<?php
/**
 * Created by PhpStorm
 * User: 龍zero
 * Date: 2022-05-16
 * Time: 16:31
 */
declare(strict_types=1);

namespace App\Request\CouponActivity;


use Hyperf\Validation\Request\FormRequest;

class CouponActivityRequest  extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'up_coupon_id' => 'required|starts_with:31',
            'sponsor_name' => 'required|min:1|max:60',
            'business_type' => 'required|in:1,2',
            'name' => 'required|between:2,60',
            'cover_img_id' => 'required|positive',
            'long_img_id' => 'positive',
            'start_time' => 'required|date_format:Y-m-d H:i:s',
            'end_time' => 'required|date_format:Y-m-d H:i:s',
            'coupon_expire_hour' => 'required|positive',
            'fee' => 'numeric',
            'full_money' => 'required|numeric',
            'minus' => 'required|numeric',
            'scope_nums' => 'required|positive',
            'grant_nums' => 'required|positive',
            'member_level' => 'positive',
            'use_rule' => 'min:1|max:1000',
            'tips' => 'min:1|max:1000',
            'disclaimer' => 'min:1|max:1000',
            'business_list' => 'requiredIf:business_type,2|array',
            'business_list.*' => 'positive',
            'display_app_ids' => 'required|checkIDs'
        ];
    }
}